package com.oa.demo.server.system.configure;

import com.baomidou.mybatisplus.core.parser.ISqlParser;
import com.baomidou.mybatisplus.extension.parsers.BlockAttackSqlParser;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 孔德成
 * @date 2020/11/30 11:29
 */
@Configuration
public class WebConfigure {
    @Bean
    public PaginationInnerInterceptor paginationInterceptor() {
//        BlockAttackSqlParser paginationInterceptor = new PaginationInterceptor();
//        List<ISqlParser> sqlParserList = new ArrayList<>();
//        sqlParserList.add(new BlockAttackSqlParser());
//        paginationInterceptor.setSqlParserList(sqlParserList);
        PaginationInnerInterceptor paginationInnerInterceptor =new PaginationInnerInterceptor();
        MybatisPlusInterceptor mybatisPlusInterceptor  =new MybatisPlusInterceptor();
        mybatisPlusInterceptor.addInnerInterceptor(paginationInnerInterceptor);
        return paginationInnerInterceptor;
    }
}
